package http

import http2 "net/http"

type Router struct {
	server  *http2.Server
	routers map[string]http2.HandlerFunc
}

func (r *Router) Handle() {
	for path, h := range r.routers {
		http2.HandleFunc(path, h)
	}
}

func (r *Router) Register(path string, handler http2.HandlerFunc) {
	r.routers[path] = handler
}

func NewRouter(server *http2.Server) *Router {
	return &Router{
		server:  server,
		routers: make(map[string]http2.HandlerFunc),
	}
}
